package com.treasure.hunt.mine

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.module.lemlin.base.BaseAbstractActivity
import com.module.lemlin.base.loadCenterImage
import com.module.lemlin.mode.ViewModeActivity
import com.treasure.hunt.R
import com.treasure.hunt.mode.CardViewMode
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import kotlinx.android.synthetic.main.activity_mine_card.*

class MineCardActivity : ViewModeActivity<CardViewMode>() {

    companion object {
        fun open(activity: Activity) {
            val intent = Intent(activity, MineCardActivity::class.java)
            activity.startActivity(intent)
        }
    }

    override val layoutResId: Int
        get() = R.layout.activity_mine_card

    override fun viewModel(): CardViewMode {
        return createViewModel()
    }

    override fun stateBar(): StatusBar {
        return StatusBar(
            isLightMode = false,
            color = R.color.FF_020027,
            bottomColor = R.color.FF_020027,
            view = flMineCardBar
        )
    }

    override fun initView() {

        ivMineCardBack.setOnClickListener {
            finish()
        }

        tvMineCardRecord.setOnClickListener {
            MineGiveActivity.open(activity = this)
        }

        val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
        transaction.replace(R.id.flMineCardBody, CardRevealFragment.newInstance())
        transaction.commit()
    }

    override fun initData() {
        viewModel.cardList()
    }
}